Audio playing interface response method and device, electronic equipment and storage medium
By setting a status monitor and updating the mapping relationship table in the audio playback application, the complex interaction problem of multi-source players is solved, and the decoupling of interface display and logic processing and the improvement of development efficiency is achieved.
Patent Information
- Application Number
- CN202411663167.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-03-21
AI Technical Summary
In the prior art, the interaction of multi-source players is complex, resulting in low development efficiency.
By setting up a status monitor in the logic processing module of the audio playback application, the audio playback status changes are monitored, and the preset mapping relationship table is updated using the sound source identifier to realize the response and display of the audio playback interface.
The interface display and logic processing functions of multi-source audio playback applications are decoupled, avoiding scheduling chaos caused by complex interactions and improving development efficiency.
Smart Images

Figure CN119669512A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of audio technology, and in particular to an audio playback interface response method, device, electronic device and storage medium. Background Art
[0002] Audio applications are applications that users use very frequently. Users often use various audio applications, such as listening to local radio, local music, online music, Bluetooth music, etc. In order to enrich the user experience, the relevant technology can make multiple audio sources in a specific application scenario into an audio collection application, such as combining multiple audio sources such as local radio, local music, online music, Bluetooth music, and online story listening in the car application scenario into one audio application, and each audio source is just a module of the audio application.
[0003] This type of multi-source audio application has complex interactions, resulting in low development efficiency. Summary of the invention
[0004] In view of this, the embodiments of the present application provide an audio playback interface response method, device, electronic device and storage medium to solve the problem of complex interaction in multi-source players in the prior art.
[0005] In a first aspect of an embodiment of the present application, there is provided an audio playback interface response method, which is executed by a scheduling module in an audio playback application, and the method includes:
[0006] Initialize the scheduling module, set at least one status monitor in the logic processing module of the audio playback application, each status monitor monitors the audio playback status of a logic processing unit, and different logic processing units process audio signals of different sound sources;
[0007] In response to determining that the target state monitor detects a change in the audio playback state of the target logical processing unit, determining the audio source identifier and the updated audio playback state of the target logical processing unit, the target logical processing unit being any logical processing unit, and the target state monitor being a monitor that monitors the target logical processing unit;
[0008] Update the preset mapping relationship table using the audio source identifier of the target logic processing unit and the updated audio playback state, so that the audio playback application displays the target audio playback sub-interface based on the updated audio playback state;
[0009] The preset mapping relationship table includes one-to-one corresponding audio source identifiers and audio playback states, and the target audio playback sub-interface and the target logic processing unit have the same audio source identifier.
[0010] A second aspect of the embodiment of the present application provides an audio playback interface response device, including:
[0011] The scheduling module sets at least one status monitor in the logic processing module of the audio playback application during initialization processing, each status monitor monitors the audio playback status of a logic processing unit, and different logic processing units process audio signals of different sound sources;
[0012] A logic processing module executes the audio playback logic and determines the audio playback status of each logic processing unit;
[0013] The scheduling module also determines the audio source identification and the updated audio playback state of the target logic processing unit under the condition that the target state monitor detects a change in the audio playback state of the target logic processing unit, and updates the preset mapping relationship table using the audio source identification and the updated audio playback state of the target logic processing unit;
[0014] An interface display module displays a target audio playback sub-interface based on the updated audio playback status;
[0015] Among them, the target logic processing unit is any logic processing unit, the target status monitor is a monitor that monitors the target logic processing unit; the preset mapping relationship table includes a one-to-one corresponding sound source identifier and audio playback status, and the target audio playback sub-interface and the target logic processing unit have the same sound source identifier.
[0016] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0017] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0018] Compared with the prior art, the embodiments of the present application have the following beneficial effects: when initializing the scheduling module, the embodiments of the present application sets at least one status monitor in the logic processing module of the audio playback application; when the target status monitor detects that the audio playback status of the target logic processing unit has changed, the preset mapping relationship table is updated using the sound source identification of the target logic processing unit and the updated audio playback status, so that the audio playback application displays the target audio playback sub-interface corresponding to the sound source identification based on the updated mapping relationship table, thereby realizing the decoupling of the interface display and logic processing functions of the multi-source audio playback application, and monitoring and scheduling the audio playback status in each decoupled functional module based on the sound source identification, thereby avoiding scheduling confusion caused by complex interactions and improving development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 It is a flowchart of an audio playback interface response method provided in an embodiment of the present application.
[0021] Figure 2 It is a flowchart of a method for an audio playback application provided in an embodiment of the present application to display a target audio playback sub-interface based on an updated audio playback status.
[0022] Figure 3 It is a flowchart of a method for a target state monitor to monitor changes in the audio playback state of a target logic processing unit provided in an embodiment of the present application.
[0023] Figure 4 It is a flowchart diagram of a method provided by an embodiment of the present application for updating the audio playback state of a target logic processing unit after the target logic processing unit executes an audio control instruction.
[0024] Figure 5 It is a flowchart of a method for setting at least one status monitor in a logic processing module of an audio playback application provided in an embodiment of the present application.
[0025] Figure 6 It is a system architecture diagram of the audio playback application provided in an embodiment of the present application.
[0026] Figure 7 It is a schematic diagram of an audio playback interface response device provided in an embodiment of the present application.
[0027] Figure 8 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0029] An audio playback interface response method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.
[0030] As mentioned above, in order to enrich the user experience, relevant technologies can make multiple audio sources in a specific application scenario into an audio collection application. For example, multiple audio sources such as local broadcast, local music, online music, Bluetooth music, and online story listening in a car application scenario can be combined into one audio application. Each audio source is just a module of the audio application.
[0031] However, in the related art, various applications are usually simply combined together to obtain a unified audio application. Each audio source module is independent of each other and controlled in its own way. This easily leads to the problem of mixing multiple audio sources when playing at the same time. At the same time, the application code structure of this combination method is chaotic, the overall development efficiency is low, and it is not easy to expand and transplant to multiple application scenarios.
[0032] In view of this, an embodiment of the present application provides an audio playback interface response method, by setting at least one status monitor in the logic processing module of the audio playback application when initializing the scheduling module, and when the target status monitor detects that the audio playback state of the target logic processing unit has changed, the preset mapping relationship table is updated using the sound source identification and the updated audio playback state of the target logic processing unit, so that the audio playback application displays the target audio playback sub-interface corresponding to the sound source identification based on the updated mapping relationship table, thereby realizing the decoupling of the interface display and logic processing functions of the multi-source audio playback application, and monitoring and scheduling the audio playback state in each decoupled functional module based on the sound source identification, avoiding scheduling confusion caused by complex interactions and improving development efficiency.
[0033] Figure 1 1 is a flow chart of an audio playback interface response method provided in an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:
[0034] In step S101, the scheduling module is initialized, and at least one state monitor is set in the logic processing module of the audio playback application.
[0035] Each status monitor monitors the audio playing status of a logic processing unit, and different logic processing units process audio signals from different sound sources.
[0036] In step S102, in response to determining that the target state monitor monitors a change in the audio playing state of the target logical processing unit, the audio source identifier and the updated audio playing state of the target logical processing unit are determined.
[0037] The target logic processing unit is any logic processing unit, and the target state monitor is a monitor that monitors the target logic processing unit.
[0038] In step S103, the preset mapping relationship table is updated using the audio source identifier of the target logic processing unit and the updated audio playing state, so that the audio playing application displays the target audio playing sub-interface based on the updated audio playing state.
[0039] The preset mapping relationship table includes one-to-one corresponding audio source identifiers and audio playback states, and the target audio playback sub-interface and the target logic processing unit have the same audio source identifier.
[0040] In certain embodiments of the present application, the method may be performed by a scheduling module in an audio playback application. The audio playback application may be a multi-source audio playback application, and the multi-source audio includes at least one audio from different sources, such as online audio, local audio, broadcast audio, Bluetooth audio, etc. The audio may include music, audio books, etc., which are not limited here. The multi-source audio is uniformly scheduled in the audio playback application, that is, the audio playback application may include a scheduling module.
[0041] In some embodiments, the scheduling module may be initialized. When initializing the scheduling module, at least one status monitor may be set in the logic processing module of the audio playback application, each status monitor monitors the audio playback status of a logic processing unit, and different logic processing units process audio signals of different sound sources.
[0042] That is to say, the audio playback application may also include a logic processing module for processing audio playback logic, including playing audio, stopping audio, pausing audio, playing the next audio, playing the previous audio, etc. The logic processing module may include multiple logic processing units, each of which corresponds to an audio source, such as an online audio logic processing unit, a local audio logic processing unit, a broadcast audio logic processing unit, a Bluetooth audio logic processing unit, etc.
[0043] For each logic processing unit, a status monitor can be set in the logic processing module when the scheduling module is initialized to detect the playback status of each logic processing unit. In one example, the playback status of the logic processing unit may include the status that needs to be displayed on the audio playback application interface, such as the current audio name, the current playback status, the current audio information, the next audio name, the previous audio name, etc. In another example, the playback status of the logic processing unit may also include an audio playback log.
[0044] In some embodiments of the present application, in response to determining that the target state monitor detects a change in the audio playback state of the target logical processing unit, the audio source identifier and the updated audio playback state of the target logical processing unit may be determined.
[0045] In one example, if a target state monitor for monitoring a target logical processing unit detects that the audio playback state of the target logical processing unit has changed, the audio source identifier and the updated audio playback state of the target logical processing unit can be determined, and the audio source identifier and the updated audio playback state can be sent to the scheduling module.
[0046] The scheduling module includes a preset mapping relationship table, which includes a one-to-one corresponding audio source identifier and audio playback status. In one example, the preset mapping relationship table can be composed of a key-value mapping table MAP<key,value> Implementation, where the key key can be an audio source identifier, such as an online audio identifier, a local audio identifier, etc., and the value value identifies the audio playback status of the audio source corresponding to the key key.
[0047] The preset mapping relationship table can be updated according to the audio source identification of the target logic processing unit and the updated audio playback state. Taking the preset mapping relationship table as a MAP table as an example, the key key in the MAP table can be first determined according to the audio source identification of the target logic processing unit, and then the value value corresponding to the key key is updated to the updated audio playback state of the target logic processing unit, so as to complete the update of the preset mapping relationship table.
[0048] The preset mapping relationship table can provide interface display data for the audio playback application, that is, the audio playback application can display the target audio playback sub-interface based on the updated audio playback state. For example, the target audio playback sub-interface can be determined according to the sound source identification of the target logical processing unit, and the target audio playback sub-interface has the same sound source identification as the target logical processing unit. For another example, the audio playback application displays the target audio playback sub-interface based on the updated audio playback state.
[0049] Taking the target logic processing unit as the logic processing unit of online audio as an example, the target audio playback sub-interface can be determined as the audio playback sub-interface of online audio. The audio playback state of the online audio playback sub-interface can be obtained according to the corresponding value of the audio source identification key of the online audio in the preset mapping relationship table, and the audio playback state is displayed in the online audio playback sub-interface, so that the audio playback interface can respond to the change of the audio playback state.
[0050] According to the technical solution provided in the embodiment of the present application, by setting at least one status monitor in the logic processing module of the audio playback application when initializing the scheduling module, when the target status monitor detects that the audio playback state of the target logic processing unit has changed, the preset mapping relationship table is updated using the sound source identification of the target logic processing unit and the updated audio playback state, so that the audio playback application displays the target audio playback sub-interface corresponding to the sound source identification based on the updated mapping relationship table, thereby realizing the decoupling of the interface display and logic processing functions of the multi-source audio playback application, and monitoring and scheduling the audio playback state in each decoupled functional module based on the sound source identification, thereby avoiding scheduling confusion caused by complex interactions and improving development efficiency.
[0051] In some embodiments of the present application, the audio playback application may further include an interface display module for displaying the status of each audio playback. The interface display module may include multiple audio playback sub-interfaces, each audio playback sub-interface corresponding to an audio source, such as an online audio playback sub-interface, a local audio playback sub-interface, a broadcast audio playback sub-interface, a Bluetooth audio playback sub-interface, etc.
[0052] The interface display module can actively monitor the preset mapping relationship table in the scheduling module to timely obtain the changes in the audio playback status. In one example, the preset mapping relationship table can be implemented by an observable data holder class, and the observer of the observable data can be the interface display module of the audio playback application. For example, the preset mapping relationship table can be packaged in a LiveData class, and the LiveData class can be monitored by the interface display module.
[0053] Figure 2 1 is a flow chart of a method for an audio playback application to display a target audio playback sub-interface based on an updated audio playback status provided by an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0054] In step S201, in response to the interface display module observing a change in the preset mapping relationship table, a changed target audio source identifier and audio playback state pair is determined.
[0055] Among them, the audio playing state in the target audio source identifier and the audio playing state pair is the changed audio playing state.
[0056] In step S202, a target audio playing sub-interface is determined according to the target audio source identifier and the audio playing state pair.
[0057] In step S203, the target audio playing sub-interface is updated according to the audio playing status in the target audio source identifier and the audio playing status pair.
[0058] In step S204, the updated target audio playback sub-interface is displayed in the display interface of the audio playback application.
[0059] In some embodiments of the present application, when the interface display module observes a change in the preset mapping relationship table, it can determine the changed target audio source identifier and audio playback state pair. Taking the preset mapping relationship table as a MAP table as an example, the interface display module can determine the changed value and its corresponding key.
[0060] In some implementations, the interface display module can determine the target audio playback sub-interface based on the determined target audio source identifier and the audio source identifier in the audio playback state. The target audio playback sub-interface is the audio playback sub-interface whose audio source identifier is the target audio source identifier. That is, if the key in the determined MAP table is key, then the audio playback sub-interface whose audio source identifier is the same as the key value can be determined as the target audio playback sub-interface.
[0061] In some other implementations, the target audio playback sub-interface may be updated according to the target audio source identifier and the audio playback state in the audio playback state pair. In other words, the target audio playback sub-interface may be updated with the value corresponding to the key key in the determined MAP table.
[0062] In some embodiments, the updated target audio playback sub-interface may be displayed in the display interface of the audio playback application, thereby enabling the audio playback application to display the target audio playback sub-interface based on the updated audio playback status.
[0063] In some embodiments of the present application, the audio playback state of the target logic processing unit changes, including the audio playback state of the target logic processing unit changes automatically and the audio playback state of the target logic processing unit changes after executing an audio control instruction.
[0064] That is, the audio playback interface can respond to the automatic state changes of the logic processing units corresponding to different audio sources, for example, the logic processing unit automatically plays the next audio after completing the current audio playback, or automatically stops playing after completing all the audio in the playlist, etc. On the other hand, the audio playback interface can also respond to the state changes after the logic processing unit executes the audio control instruction, for example, the logic processing unit executes the audio control instruction issued by the user in the audio playback application operation interface.
[0065] In this way, the interface display module of the audio playback application can easily and accurately obtain the changes in the audio playback status of different audio sources, and display the changed audio playback status on the interface.
[0066] Figure 31 is a flow chart of a method for a target state monitor to monitor changes in the audio playback state of a target logic processing unit provided in an embodiment of the present application. Figure 3 As shown, the method includes:
[0067] In step S301, the scheduling module receives an audio control instruction.
[0068] The audio control instruction includes an audio source identifier.
[0069] In step S302 , the scheduling module sends an audio control instruction to a target logic processing unit.
[0070] The target logic processing unit is the logic processing unit corresponding to the sound source identifier.
[0071] In step S303, after executing the audio control instruction, the target logic processing unit updates the audio playing state of the target logic processing unit.
[0072] In step S304, the target state monitor monitors and determines whether the audio playing state of the target logic processing unit changes.
[0073] Under the condition that the audio playback state of the target logic processing unit changes after executing the audio control instruction, the scheduling module can receive the audio control instruction, and the audio control instruction includes the sound source identifier. In one example, the scheduling module sends the audio control instruction to the target logic processing unit, and the target logic processing unit is the logic processing unit corresponding to the sound source identifier. After executing the audio control instruction, the target logic processing unit updates the audio playback state of the target logic processing unit. When the target state monitor detects that the target logic processing unit updates its audio playback state, it can be determined that the audio playback state of the target logic processing unit has changed.
[0074] Figure 4 1 is a flow chart of a method for updating the audio playback state of a target logic processing unit after executing an audio control instruction provided by an embodiment of the present application. Figure 4 As shown, the method comprises the following steps:
[0075] In step S401, the target logic processing unit parses the audio control instruction, and calls the playback control method corresponding to the target logic processing unit to execute the audio control instruction according to the parsing result.
[0076] In step S402, in response to determining that the execution of the audio control instruction is completed, the audio playing state of the target logical processing unit is updated.
[0077] In certain embodiments of the present application, each logic processing unit in the logic processing module can be configured with a playback control method, which can execute playback control operations corresponding to the control instructions, such as playing audio, pausing audio, stopping audio, playing the next audio, playing the previous audio, etc.
[0078] The target logic processing unit can parse the received audio control instruction and call the corresponding playback control method of the target logic processing unit to execute the audio control instruction according to the parsing result. If the audio control instruction is determined to be executed, the target logic processing unit can update its own audio playback state.
[0079] For example, when the target logical processor receives a control instruction to play the next audio, the target logical processor parses the control instruction and executes the operation of playing the next audio. After the operation is completed, the audio playing state of the target logical processor is updated to the state of playing the next audio, such as updating the name of the currently playing audio to the audio name of the next audio, and updating the text content corresponding to the currently playing audio to the text content corresponding to the next audio.
[0080] In some embodiments of the present application, the scheduling module may further include a control interface and a status callback interface. Among them, the scheduling module may use the control interface to receive audio control instructions from the interface display module, and use the control interface to send the audio control instructions to the logic processing module. On the other hand, the scheduling module may also use the status callback interface to receive the audio playback status of each logic processing unit from the logic processing module, and use the status callback interface to send the audio playback status to the interface display module.
[0081] That is, the scheduling module may include two types of interfaces: a control interface and a status callback interface. Since the audio playback application includes multiple audio sources, all control interface and status callback interface parameters need to include an audio source identifier.
[0082] When the scheduling module receives a control instruction from the control interface, the scheduling module sends the control instruction to the corresponding logic processing unit according to the sound source identifier. When the logic processing unit has data such as audio playback status to be transmitted back, the logic processing unit transmits the sound source identifier and status data back to the scheduling module through the status callback interface. The scheduling module can store the playback status data in a Map, where the key of the Map is the sound source identifier and the value is the playback status data. The interface display module updates the interface according to the changes in the Map that stores the playback status data. When the interface display module monitors the changes in the Map, it will retrieve the playback status data of the corresponding sound source from the Map to update the interface.
[0083] Figure 51 is a flow chart of a method for setting at least one status monitor in a logic processing module of an audio playback application provided by an embodiment of the present application. Figure 5 As shown, the method comprises the following steps:
[0084] In step S501, each logical processing unit manager object is created.
[0085] In step S502, a status monitor is created.
[0086] In step S503, a status monitor is set in each logical processing unit manager object.
[0087] In some embodiments of the present invention, the scheduling module may create each logic processing unit manager object and a status monitor during initialization, and then set the status monitor in each logic processing unit manager object, thereby setting at least one status monitor in the logic processing module of the audio playback application.
[0088] Figure 6 : is a system architecture diagram of the audio playback application provided in the embodiment of the present application. Figure 6 As shown, the audio playback application system includes an interface display module, a scheduling module and a logic processing module. Among them, the interface display module at least includes an online audio sub-interface, a local audio sub-interface, a broadcast audio sub-interface and a Bluetooth audio sub-interface, and the logic processing module at least includes an online audio logic processor, a local audio logic processor, a broadcast audio logic processor and a Bluetooth audio logic processor.
[0089] The scheduling module receives control instructions from the interface display module through the control interface, and sends the control instructions to the logic processing module through the control interface. The logic processing module sends the audio playback status to the scheduling module through the status callback interface, and the scheduling module sends the audio playback status to the interface display module through the status callback interface.
[0090] The scheduling module completes the creation of each logical processing unit object during initialization, creates a status monitor, and sets the status monitor to each logical processing unit.
[0091] The scheduling module receives the audio playback status sent back from each logic processing unit through the status monitor, and stores the audio playback status data in the data structure Map. The key of the Map is the audio source identifier, and the value is the audio playback status. In one example, the Map can be wrapped in LiveData. After monitoring the changes of the LiveData wrapped in the Map, the interface display module takes out the value of the corresponding audio source from the Map to update the interface.
[0092] The interface display module passes the sound source identifier to the scheduling module to call the control method of the scheduling module. The scheduling module determines which logic processing unit object to use based on the sound source identifier and calls its control method. When the control method of the logic processing unit is called, the music player control method in the logic processing unit can continue to be called.
[0093] When the logic processor receives the audio playback status sent back by the music player, it uses the status monitor sent by the scheduling module to send the audio playback status back to the scheduling module, and also sends the corresponding sound source identifier back to the scheduling module. For example, if the sound source identifier of online music is set to 1, when sending back the audio playback status of online music, the sound source identifier 1 can be sent back to the scheduling module.
[0094] Part of the pseudo code of the system for the audio playback application provided in the embodiment of the present application is as follows:
[0095] public interface IPlayStateInterface{ / / Define the state callback interface
[0096] void onPlayState(int source, int playState); / / Define the state acquisition method, where source is the audio source identifier and playState is the audio playback state
[0097] }
[0098] public class AudioPlayDispatcher{ / / Define the core class of the dispatch module
[0099] private OnlineMuiscManager mOnlineMuiscManager; / / Online music logic processing unit
[0100] private BlueToothMuiscManager mBlueToothMuiscManager; / / Bluetooth music logic processing unit
[0101] private LocalMuiscManager mLocalMuiscManager; / / Local music logic processing unit
[0102] private LocalRadioManager mLocalRadioManager; / / Local broadcast logic processing unit
[0103] private IPlayStateInterface mPlayStateListener; / / State monitor
[0104] private MutableLiveData <Map<Integer,Integer> >mPlayState; / / Store the playback state. The interface display module updates the interface by monitoring the changes in the playback state.
[0105] public void init(){ / / Complete the creation of each logical processing unit object when the scheduling module is initialized
[0106] mOnlineMuiscManager=new OnlineMuiscManager();
[0107] mBlueToothMuiscManager=new BlueToothMuiscManager();
[0108] mLocalMuiscManager=new LocalMuiscManager();
[0109] mLocalRadioManager=new LocalRadioManager();
[0110] mPlayStateListener = new IPlayStateInterface() { / / Create a state monitor when the scheduling module is initialized
[0111] @Override
[0112] onPlayState(int source, int playState){ / / The scheduling module receives the audio playback status returned by each logic processing unit here and stores the audio playback status in mPlayState
[0113] }
[0114] };
[0115] / / Set the status monitor in each logic processing unit
[0116] mOnlineMuiscManager.setListener(mPlayStateListener);
[0117] mBlueToothMuiscManager.setListener(mPlayStateListener);
[0118] mLocalMuiscManager.setListener(mPlayStateListener);
[0119] mLocalRadioManager.setListener(mPlayStateListener);
[0120] mPlayState=new MutableLiveData<>();
[0121] }
[0122] public void play(int source){ / / Determine which logic processor's play method to call based on source. For example, you can assume that the source type of online music is 1, the source type of Bluetooth music is 2, the source type of local music is 3, and the source type of local broadcast is 4switch(source){
[0123] case 1:{
[0124] mOnlineMuiscManager.play();
[0125] break;
[0126] }
[0127] case 2:
[0128] mBlueToothMuiscManager.play();
[0129] break;
[0130] }
[0131] case 3:
[0132] mLocalMuiscManager.play();
[0133] break;
[0134] }
[0135] case 4:
[0136] mLocalRadioManager.play();
[0137] break;
[0138] }
[0139] }
[0140] }
[0141] / / Determine which logical processing unit to call to pause based on source public void pause(int source){
[0142] switch(source){
[0143] case 1:{
[0144] mOnlineMuiscManager.pause();
[0145] break;
[0146] }
[0147] case 2:
[0148] mBlueToothMuiscManager.pause();
[0149] break;
[0150] }
[0151] case 3:
[0152] mLocalMuiscManager.pause();
[0153] break;
[0154] }
[0155] case 4:
[0156] mLocalRadioManager.pause();
[0157] break;
[0158] }
[0159] }
[0160] }
[0161] }
[0162] The main logic of each logic processing unit is to receive the control instructions sent by the scheduling module and return the audio playback status to the scheduling module. For example, the logic processing unit class code of online audio is as follows:
[0163] public class OnlineMuiscManager{
[0164] private IPlayStateInterface mListener;
[0165] private OnlineMuiscPlayer mPlayer=new OnlineMuiscPlayer();
[0166] / / Receive status monitor from scheduling module
[0167] public void setListener(IPlayStateInterface listener){
[0168] mListener = listener;
[0169] }
[0170] public void play(){
[0171] / / When receiving the playback control from the scheduling module, call the playback method of the online music player
[0172] mPlayer.play();
[0173] }
[0174] public void pause(){
[0175] / / When receiving the playback control from the scheduling module, call the pause method of the online music player
[0176] mPlayer.pause();
[0177] }
[0178] / / Monitor the audio playback status of the music player and pass it back to the scheduling module
[0179] public OnlineMuiscManager(){
[0180] mPlayer.setOnlineMuiscPlayerStateListener(new PlayStateCallback(){
[0181] @Override
[0182] onPlayStateCallback(int state){
[0183] / / 1: indicates the source type of online music, state: indicates the playback status
[0184] mListener.onPlayState(1,state);
[0185] }
[0186] };
[0187] }
[0188] }
[0189] By adopting the technical solution of the embodiment of the present application, unified management of the control logic and playback status logic of different audio sources is achieved, avoiding logical confusion in each module. A unified framework and interface are defined, the project engineering structure is clear, and development efficiency can be significantly improved, eliminating a lot of repeated control logic and data callback logic, and reducing development costs.
[0190] At the same time, since the playback status can also record the playback log, the efficiency of problem location can be significantly improved. When an audio playback application failure occurs, the fault location can be quickly located based on the sound source identification.
[0191] In addition, this method can also effectively solve the problem of mixing multiple audio sources. When the playback interface of the scheduling layer is called, the currently playing audio source can be quickly and conveniently paused at the scheduling layer, thereby ensuring that only one audio source is always playing, and no business code of the dynamic interface layer is required.
[0192] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0193] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0194] Figure 7 Schematic diagram of an audio playback interface response device provided in an embodiment of the present application. Figure 7 As shown, the device comprises:
[0195] The scheduling module 701 sets at least one status monitor in the logic processing module of the audio playback application during initialization processing. Each status monitor monitors the audio playback status of a logic processing unit. Different logic processing units process audio signals of different sound sources.
[0196] The logic processing module 702 executes the audio playing logic and determines the audio playing status of each logic processing unit.
[0197] The scheduling module 701 also determines the audio source identification and updated audio playback status of the target logical processing unit under the condition that the target state monitor detects a change in the audio playback status of the target logical processing unit, and updates the preset mapping relationship table using the audio source identification and updated audio playback status of the target logical processing unit.
[0198] The interface display module 703 displays the target audio playback sub-interface based on the updated audio playback status.
[0199] Among them, the target logic processing unit is any logic processing unit, the target status monitor is a monitor that monitors the target logic processing unit; the preset mapping relationship table includes a one-to-one corresponding sound source identifier and audio playback status, and the target audio playback sub-interface and the target logic processing unit have the same sound source identifier.
[0200] According to the technical solution provided in the embodiment of the present application, by setting at least one status monitor in the logic processing module of the audio playback application when initializing the scheduling module, when the target status monitor detects that the audio playback state of the target logic processing unit has changed, the preset mapping relationship table is updated using the sound source identification of the target logic processing unit and the updated audio playback state, so that the audio playback application displays the target audio playback sub-interface corresponding to the sound source identification based on the updated mapping relationship table, thereby realizing the decoupling of the interface display and logic processing functions of the multi-source audio playback application, and monitoring and scheduling the audio playback state in each decoupled functional module based on the sound source identification, thereby avoiding scheduling confusion caused by complex interactions and improving development efficiency.
[0201] In some embodiments, the preset mapping relationship table is implemented through an observable data holder class, and the observer of the observable data is an interface display module of the audio playback application, and the interface display module includes various audio playback sub-interfaces; the audio playback application displays the target audio playback sub-interface based on the updated audio playback status, including: in response to the interface display module observing a change in the preset mapping relationship table, determining a changed target audio source identifier and audio playback status pair, the audio playback status in the target audio source identifier and audio playback status pair being the changed audio playback status; determining the target audio playback sub-interface according to the audio source identifier in the target audio source identifier and audio playback status pair; updating the target audio playback sub-interface according to the audio playback status in the target audio source identifier and audio playback status pair; and displaying the updated target audio playback sub-interface in the display interface of the audio playback application.
[0202] In some implementations, the audio playback state of the target logic processing unit changes, including the audio playback state of the target logic processing unit changing automatically and the audio playback state of the target logic processing unit changing after executing the audio control instruction.
[0203] In some embodiments, in response to determining that the audio playback state of the target logical processing unit changes after executing an audio control instruction, a target state monitor monitors the change in the audio playback state of the target logical processing unit, including: a scheduling module receives an audio control instruction, the audio control instruction includes a sound source identifier; the scheduling module sends the audio control instruction to the target logical processing unit, the target logical processing unit is the logic processing unit corresponding to the sound source identifier; after executing the audio control instruction, the target logical processing unit updates the audio playback state of the target logical processing unit; the target state monitor monitors and determines that the audio playback state of the target logical processing unit changes.
[0204] In some implementations, after executing the audio control instruction, the target logical processing unit updates the audio playback state of the target logical processing unit, including: the target logical processing unit parses the audio control instruction, and calls the playback control method corresponding to the target logical processing unit to execute the audio control instruction according to the parsing result; in response to determining that the execution of the audio control instruction is completed, updating the audio playback state of the target logical processing unit.
[0205] In some embodiments, the scheduling module also includes a control interface and a status callback interface; the scheduling module uses the control interface to receive audio control instructions from the interface display module, and uses the control interface to send the audio control instructions to the logic processing module; and the scheduling module uses the status callback interface to receive the audio playback status of each logic processing unit from the logic processing module, and uses the status callback interface to send the audio playback status to the interface display module.
[0206] In some implementations, setting at least one status monitor in the logic processing module of the audio playback application includes: creating each logic processing unit manager object; creating a status monitor; and setting the status monitor in each logic processing unit manager object.
[0207] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0208] Figure 8 Schematic diagram of an electronic device provided in an embodiment of the present application. Figure 8As shown, the electronic device 8 of this embodiment includes: a processor 801, a memory 802, and a computer program 803 stored in the memory 802 and executable on the processor 801. When the processor 801 executes the computer program 803, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 801 executes the computer program 803, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0209] The electronic device 8 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 8 may include, but is not limited to, a processor 801 and a memory 802. Those skilled in the art will appreciate that Figure 8 The electronic device 8 is merely an example and does not limit the electronic device 8 . The electronic device 8 may include more or fewer components than those shown in the figure, or different components.
[0210] The processor 801 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0211] The memory 802 may be an internal storage unit of the electronic device 8, for example, a hard disk or memory of the electronic device 8. The memory 802 may also be an external storage device of the electronic device 8, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 8. The memory 802 may also include both an internal storage unit of the electronic device 8 and an external storage device. The memory 802 is used to store computer programs and other programs and data required by the electronic device.
[0212] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0213] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. Computer-readable media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0214] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. An audio playback interface response method, characterized in that: The method is executed by a scheduling module in an audio playback application, and the method includes: Initialize the scheduling module, set at least one status monitor in the logic processing module of the audio playback application, each status monitor monitors the audio playback status of a logic processing unit, and different logic processing units process audio signals of different sound sources; In response to determining that the target state monitor detects a change in the audio playback state of the target logical processing unit, determining the audio source identifier and the updated audio playback state of the target logical processing unit, the target logical processing unit being any logical processing unit, and the target state monitor being a monitor that monitors the target logical processing unit; Updating a preset mapping relationship table using the audio source identifier of the target logic processing unit and the updated audio playback state, so that the audio playback application displays a target audio playback sub-interface based on the updated audio playback state; The preset mapping relationship table includes one-to-one corresponding audio source identifiers and audio playback states, and the target audio playback sub-interface and the target logic processing unit have the same audio source identifier.
2. The method according to claim 1, characterized in that: The preset mapping relationship table is implemented by an observable data holder class, the observer of the observable data is an interface display module of the audio playback application, and the interface display module includes various audio playback sub-interfaces; The audio playback application displays a target audio playback sub-interface based on the updated audio playback status, including: In response to the interface display module observing a change in the preset mapping relationship table, determining a changed target audio source identifier and audio playback state pair, the audio playback state in the target audio source identifier and audio playback state pair being the changed audio playback state; Determine a target audio playback sub-interface according to the target audio source identifier and the audio playback state pair; Update the target audio playback sub-interface according to the target audio source identifier and the audio playback status in the audio playback status pair; The updated target audio playback sub-interface is displayed in the display interface of the audio playback application.
3. The method according to claim 1, characterized in that The audio playing state of the target logic processing unit changes, including that the audio playing state of the target logic processing unit changes automatically and that the audio playing state of the target logic processing unit changes after executing an audio control instruction.
4. The method according to claim 3, characterized in that: In response to determining that the audio playback state of the target logic processing unit changes after executing the audio control instruction, the target state monitor monitors the change of the audio playback state of the target logic processing unit, including: The scheduling module receives an audio control instruction, wherein the audio control instruction includes a sound source identifier; The scheduling module sends the audio control instruction to a target logic processing unit, where the target logic processing unit is a logic processing unit corresponding to the sound source identifier; After executing the audio control instruction, the target logic processing unit updates the audio playing state of the target logic processing unit; The target state monitor monitors and determines whether the audio playback state of the target logic processing unit changes.
5. The method according to claim 4, characterized in that After executing the audio control instruction, the target logic processing unit updates the audio playback state of the target logic processing unit, including: The target logic processing unit analyzes the audio control instruction, and calls the playback control method corresponding to the target logic processing unit to execute the audio control instruction according to the analysis result; In response to determining that the execution of the audio control instruction is complete, updating the audio playback state of the target logical processing unit.
6. The method according to claim 3, characterized in that The scheduling module also includes a control interface and a status callback interface; The scheduling module receives the audio control instruction from the interface display module using the control interface, and sends the audio control instruction to the logic processing module using the control interface; as well as The scheduling module receives the audio playing status of each logic processing unit from the logic processing module by using the status callback interface, and sends the audio playing status to the interface display module by using the status callback interface.
7. The method according to claim 1, characterized in that The step of setting at least one status monitor in the logic processing module of the audio playback application comprises: Create each logical processing unit manager object; Create a condition monitor; The status monitor is set in each logical processing unit manager object.
8. An audio playback interface response device, characterized in that: include: A scheduling module, wherein during initialization processing, the scheduling module sets at least one status monitor in the logic processing module of the audio playback application, each status monitor monitors the audio playback status of a logic processing unit, and different logic processing units process audio signals of different sound sources; A logic processing module executes the audio playback logic and determines the audio playback status of each logic processing unit; The scheduling module also determines the audio source identifier and the updated audio playback state of the target logic processing unit under the condition that the target state monitor detects a change in the audio playback state of the target logic processing unit, and updates the preset mapping relationship table using the audio source identifier and the updated audio playback state of the target logic processing unit; An interface display module displays a target audio playback sub-interface based on the updated audio playback status; Among them, the target logical processing unit is any logical processing unit, the target status monitor is a monitor that monitors the target logical processing unit; the preset mapping relationship table includes a one-to-one corresponding sound source identifier and audio playback status, and the target audio playback sub-interface has the same sound source identifier as the target logical processing unit.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.